-
Notifications
You must be signed in to change notification settings - Fork 120
8359370: [lworld] allow instance fields of identity classes to be readable in the prologue phase #1523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: lworld
Are you sure you want to change the base?
8359370: [lworld] allow instance fields of identity classes to be readable in the prologue phase #1523
Conversation
|
👋 Welcome back vromero! A progress list of the required criteria for merging this PR into |
|
@vicente-romero-oracle This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
| ListBuffer<JCTree> prologueCode = new ListBuffer<>(); | ||
| for (JCTree stat : tree.body.stats) { | ||
| prologueCode.add(stat); | ||
| // gather all the stats in the body until a `super` or `this` invocation is found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should explain that super/this invocation is included because its arguments are restricted too.
| @@ -18,7 +18,7 @@ class InnerSuperclass { } | |||
| static class InnerOuter extends EarlyIndirectOuterCapture { // accessible | |||
| class InnerInnerOuter extends EarlyIndirectOuterCapture { // not accessible | |||
| InnerInnerOuter() { | |||
| super(/* which enclosing instance here ? */new InnerSuperclass() { }); | |||
| super(new InnerSuperclass() { }); // should this be accepted?, InnerSuperclass is not an inner class of InnerInnerOuter | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably yes, I think our agreement last time is that local/anonymous classes' captures, including the "outer this", are synthetic.
| @@ -2,7 +2,7 @@ | |||
| * @test /nodynamiccopyright/ | |||
| * @bug 8334258 | |||
| * @summary Disallow early assignment if FLEXIBLE_CONSTRUCTORS preview feature is not enabled | |||
| * @compile/fail/ref=EarlyAssignmentNoPreview1.out -XDrawDiagnostics EarlyAssignmentNoPreview1.java | |||
| * @compile/fail/ref=EarlyAssignmentNoPreview1.out --release 24 -XDrawDiagnostics EarlyAssignmentNoPreview1.java | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test along with EarlyAssigmentNoPreview 2 and 3 are failing. But the idea is to integrate this PR after the code for flexible constructor bodies have been merged into lworld, which should make these 3 tests pass
|
@vicente-romero-oracle this pull request can not be integrated into git checkout JDK-8359370-v2
git fetch https://git.openjdk.org/valhalla.git lworld
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge lworld"
git push |
Before this fix only strict fields were readable in the prologue phase. The proposed fix should allow any instance fields of identity classes to be readable in the prologue phase. This implies changes in flow analysis as before we were only tracking final and strict fields. There is also some "cooperation" needed in the code to detect cases when reading a field is not allowed in the prologue phase. For example some methods in Resolve don't have all the needed information at the moment they are dealing with some ASTs and part of the processing needs to be done in Attr
TIA
This PR is a remake of #1490
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1523/head:pull/1523$ git checkout pull/1523Update a local copy of the PR:
$ git checkout pull/1523$ git pull https://git.openjdk.org/valhalla.git pull/1523/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1523View PR using the GUI difftool:
$ git pr show -t 1523Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1523.diff
Using Webrev
Link to Webrev Comment